﻿using MyCompanyName.AbpZeroTemplate.OperateCenter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MyCompanyName.AbpZeroTemplate.Web.Areas.Mpa.Controllers
{
    public class OperateCenterController : Controller
    {
        private readonly IOperateCenterService _operateCenterAppService;
        public OperateCenterController(IOperateCenterService operateCenterAppService)
        {
            _operateCenterAppService = operateCenterAppService;
        }

        // GET: Mpa/OperateCenter
        public ActionResult Index()
        {
            return View();
        }

        /// <summary>
        /// 卡片日用量
        /// </summary>
        /// <returns></returns>
        public ActionResult OperateDailyReport()
        {
            return View();
        }
        /// <summary>
        /// 获得卡片日用量列表数据
        /// </summary>
        /// <returns></returns>
        public ActionResult GetOperateDailyReportDataTable(int offset, int limit)
        {
            //参数
            string Filter1SearchName = Request["Filter1SearchName"];
            string OperateDailyReportName = Filter1SearchName;
            int PageSize = limit;
            int PageNumber = (offset / limit) + 1;
            //获得数据
            var result = _operateCenterAppService.GetOperateDailyReportDtoList(OperateDailyReportName, PageSize, PageNumber);
            //var resultGet = result.Skip(offset).Take(limit).ToList();
            object data = new { total = result.Items.Count, rows = result.Items };
            return Json(data, JsonRequestBehavior.AllowGet);
        }

        /// <summary>
        /// 卡片月用量
        /// </summary>
        /// <returns></returns>
        public ActionResult OperateMonthReports()
        {
            return View();
        }

        /// <summary>
        /// 获得卡片月用量列表数据
        /// </summary>
        /// <returns></returns>
        public ActionResult GetOperateMonthReportDataTable(int offset, int limit)
        {
            //参数
            string Filter1SearchName = Request["Filter1SearchName"];
            string OperateMonthReportName = Filter1SearchName;
            int PageSize = limit;
            int PageNumber = (offset / limit) + 1;
            //获得数据
            var result = _operateCenterAppService.GetOperateMonthReportDtoList(OperateMonthReportName, PageSize, PageNumber);
            //var resultGet = result.Skip(offset).Take(limit).ToList();
            object data = new { total = result.Items.Count, rows = result.Items };
            return Json(data, JsonRequestBehavior.AllowGet);
        }
    }
}